import com.jfinal.core.Controller;
import com.jfinal.kit.HttpKit;
import com.jfinal.log.Log;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @authc yaowk
 * 2017/6/16
 */
public class IndexController extends Controller {

    public void gateway() {
        String body = "";
        StringBuilder stringBuilder = new StringBuilder();
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getRequest().getInputStream()));

            String str = null;
            while ((str = bufferedReader.readLine()) != null) {
                stringBuilder.append(str);

            }
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        body = stringBuilder.toString();
        Log.getLog("").info(body);
        String receive = HttpKit.post("https://kfshopapi.51youdian.com/gateway", body);
        renderText(receive);
    }
}
